﻿<%@ Page Title="Frontdesk - Invite Beta Users" Language="C#" MasterPageFile="~/Views/Shared/FrontdeskClean.Master"
    Inherits="System.Web.Mvc.ViewPage<IEnumerable<Sendz.WebUI.Models.InviteViewModel>>" %>

<asp:Content ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        You've Got Frontdesk Beta Invitations To Share!</h2>
    <p>
        <% if (TempData["MessageScreen"] != null)
           { %>
        <%: TempData["MessageScreen"] %>
        <% }
           else
           { %>
        Thanks very much for sharing Frontdesk with your friends. Whether you enjoyed our
        web form and autoresponder system, or you're just in a giving mood, we appreciate
        it. If you happen to run out of invitations, just ask us for more. We're generous
        ourselves.
        <% } %>
    </p>
    <% using (Ajax.BeginForm(new AjaxOptions { UpdateTargetId = "wrapper", OnBegin = "onBegin", InsertionMode = InsertionMode.Replace }))
       { %>
    <div class="header">
        Enter up to
        <%: Model.Count()%>
        email address<% if (Model.Count() > 1) Response.Write("es"); %></div>
    <%
        foreach (var invite in Model)
        { %>
    <% // Hidden values ////////////////////// %>
    <%: Html.Hidden("invites.Index", invite.Id)%>
    <%: Html.Hidden(string.Format("invites[{0}].Id", invite.Id), invite.Id)%>
    <%                       
        Html.RenderPartial("invite", invite);
        }
    %>
    <div class="buttons">
        <%: Html.Hidden("Message") %>
        <input type="submit" class="button" value="Send Invitations" onclick="preSave();" /><div
            id="loading">
        </div>
    </div>
    <%
        }%>
</asp:Content>
<asp:Content ContentPlaceHolderID="Sidebar" runat="server">
    <h2>
        Include a Message!</h2>
    <p class="caption justify padding-right">
        If you want to include a custom message with each of your invitations, just fill
        out this form with what you'd like to say and it will be appended to the message
        that gets sent. Thanks!</p>
    <%: Html.TextArea("DraftMessage", Convert.ToString(ViewData["InviteMessage"]), new { rows = 10, cols = 20, @class = "frontdesk" })%>
</asp:Content>
<asp:Content ContentPlaceHolderID="footer" runat="server">
    <script type="text/javascript">
        function preSave() {
            $('#Message').val($('#DraftMessage').val());
        }
    </script>
</asp:Content>
